import {
  createRouter,
  createWebHashHistory
} from 'vue-router'

const routes = [{
    path: '',
    redirect: '/sy', //重定向   默认首页
  },
  {
    path: '/sy',
    name: 'sy',
    component: () => import('../views/sy/Sy.vue')
  },
  {
    path: '/ksy',
    name: 'ksy',
    component: () => import('../views/ksy/Ksy.vue')
  },
  {
    path: '/zsy',
    name: 'zsy',
    component: () => import('../views/zsy/Zsy.vue')
  },
  {
    path: '/tyy',
    name: 'home',
    component: () => import('../views/tyy/Tyy.vue')
  },
  {
    path: '/day',
    name: 'day',
    component: () => import('../views/day/Day.vue'),
    children: []
  },
  {
    path: '/fwy',
    name: 'fwy',
    component: () => import('../views/fwy/Fwy.vue')
  },
  {
    name: 'people',
    path: '/people',
    component: () => import('../views/day/dayPage/DayPeople.vue')
  }, {
    name: 'enterprise',
    path: '/enterprise',
    component: () => import('../views/day/dayPage/DayEnterprise.vue')
  }, {
    name: 'family',
    path: '/family',
    component: () => import('../views/day/dayPage/Dayfamily.vue')
  }, {
    name: 'room',
    path: '/room',
    component: () => import('../views/day/dayPage/DayRoom.vue')
  }, {
    name: 'car',
    path: '/car',
    component: () => import('../views/day/dayPage/DayCar.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router

// router.beforeEach((to, from, next) => {
//   if (to.matched.length == 0) { router.push(to.path); }
//   next()
//   })